import React from 'react'
import styles from '../css/list.module.css'
import { useNavigate } from 'react-router-dom'
function TrainItem(props) {
    let nav=useNavigate()
  return (
    <div className={styles.TrainItem} onClick={()=>nav(`/detail/${props.id}?start=${props.startStation}&end=${props.endStation}`)}>
      <div className={styles.row}>
        <div className={styles.row1}>
            <span>{props.startTime}</span>
            <span>{props.startStation}</span>
        </div>
        <div className={styles.row1}>
            <span>{props.trainNo}</span>
            <span>{props.timeTaken}</span>
        </div>
        <div className={styles.row1}>
            <span>{props.endTime}</span>
            <span>{props.endStation}</span>
        </div>
        <div className={styles.row1}>
            <span>￥{props.ssoftSeat.price}起</span>
        </div>
      </div>
      <div className={styles.row2}>
        <span>二等：{props.ssoftSeat.ticketNum}</span>
         <span>一等：{props.fsoftSeat.ticketNum}</span>
          <span>商务：{props.businessSeat.ticketNum}</span>
           <span></span>
      </div>
    </div>
  )
}

export default TrainItem
